package aom.ju.ss.view.pay

import androidx.recyclerview.widget.LinearLayoutManager
import aom.ju.ss.R
import aom.ju.ss.databinding.DickerPlaceOrderBinding
import aom.ju.ss.mode.GoodsInfoData
import aom.ju.ss.utils.BigDecimalUtils
import aom.ju.ss.view.base.BaseActivity
import com.google.gson.Gson

/**
 * 易货提交订单
 */
class DickerPlaceAnOrder : BaseActivity() {
    lateinit var mode: GoodsInfoData
    var ckp = 0
    var num = 0
    lateinit var binding: DickerPlaceOrderBinding
    override fun init() {
        binding = viewBinding as DickerPlaceOrderBinding
        mode = Gson().fromJson(intent.getStringExtra("data"), GoodsInfoData::class.java)
        ckp = intent.getIntExtra("ckp", 0)
        num = intent.getIntExtra("num", 0)

        binding.num.text = BigDecimalUtils.mul(mode.skus!![ckp].price, num.toString(), 2)

        mode.ps = true
        binding.info = mode
        binding.rgSzhy.setOnCheckedChangeListener { _, cid ->
            mode.ps = cid == R.id.peisong
            binding.info = mode
        }

        binding.rec.layoutManager=LinearLayoutManager(activity)

    }

    override val lay: Int = R.layout.dicker_place_order
}